package testdomainpubliccontest;

import conditionsAPI.ConditionDuplicatedException;
import conditionsAPI.SimpleDomainCondition;

public class TractorCondition extends SimpleDomainCondition {

	private String type;
	private int quantity;
	
	public TractorCondition(String id) throws ConditionDuplicatedException {
		super(id);
	}
	
	public void setType(String type) {
		this.type = type;
	}
	
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	
	@Override
	public boolean checkConditionState(Object domainObject) {
		Requirement requirement = (Requirement) domainObject;
		if (requirement.getDescription().equals(Requirement.Description.TRACTOR) && (requirement.getType().equals(this.type)) && (requirement.getValue() == this.quantity))
			return true;
		else 		
			return false;
	}
	
	protected boolean resetToInitialState(){
		return false;
	}
}
